﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using CommServer.Common.Json;

namespace CommServer
{
    public class Config
    {
        private static JsonValue m_Config;
        static Config()
        {
            try
            {
                string s = File.ReadAllText("config.json");
                m_Config = JsonValue.Parse(s);
            }
            catch (Exception ex)
            {
                Console.WriteLine("read config.json error:" + ex.Message);
                m_Config = new JsonObject();
            }
        }

        public static string GetStringValue(string Key)
        {
            return m_Config[Key];
        }
        public static int GetIntValue(string Key)
        {
            return m_Config[Key];
        }
        public static void SetIntValue(string Key, int Value)
        {
            m_Config[Key] = Value;
        }
        public static void SetStringValue(string Key, string Value)
        {
            m_Config[Key] = Value;
        }
    }
}
